<script setup>
import { defineEmits, defineProps } from 'vue'
import { getToken } from '@/utils/auth';
const emit = defineEmits(['click'])
const props = defineProps({
  isLogin: Boolean,
  icon: {
    type: String,
    default: ''
  },
  iconPosition: {
    type: String,
    default: 'left'
  },
  type: {
    type: String,
    default: 'default'
  },
  size: {
    type: String,
    default: 'medium'
  },
  round: String,
  disabled: {
    type: Boolean
  }

})

function handleButtonClick() {
  if (props.isLogin && !getToken()) {
    uni.navigateTo({
      url: '/pages/wxlogin/index'
    })
    return;

  }
  emit('click')

}
</script>
<template>
  <!-- props--{{ props }}
  round--{{ round }} -->
  <van-button v-bind="attrs" :round="round" :type="props.type" @click="handleButtonClick">
    <slot />
  </van-button>
</template>

<style lang="less" scoped></style>
